package com.wkn.wknAdmin.controller;

import com.wkn.wknAdmin.entity.Menu;
import com.wkn.wknAdmin.result.ResultVO;
import com.wkn.wknAdmin.service.MenuService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


/**
 * @Title:
 * @Description:
 * @Author: WKN
 * CreateDate: 2022/8/13 14:34
 */

@RestController
@RequestMapping("/menu")
public class MenuController {



    @Resource
    private MenuService menuService;

    ResultVO result = new ResultVO();


    /**
     * 添加或更新菜单
     *
     * @param menu
     * @return
     */
    @PostMapping("/save")
    public ResultVO save(@RequestBody Menu menu ) {
        return menuService.save(menu);
    }



    @GetMapping("/findAll")
    public ResultVO findAll() {
        return menuService.findAll();
    }


    @GetMapping("/ids")
    public ResultVO findAllIds(){
        return result.Success(menuService.findAllIds());
    }


}
